Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug resulting from changing v5's default solver #190

Merged
merged 2 commits into from
Jan 21, 2023

Conversation

Ericgig
Copy link
Member

@Ericgig Ericgig commented Jan 19, 2023

We removed the old solvers that were existing in parallel to the new ones in qutip v5. This broke a few tests.

  • Solvers options are now simple dict. The default options are per solver basis and unknown to qutip.Options.
  • qutip.Options and qutip.SolverOptions are equivalent and deprecated.
  • mcsolve can accept density matrix input, it use state= instead of rho0=.
  • array(qobj) should have been not working for a while now, full() is the method preferred when converting to a numpy array.
  • I had to reduce the max_step for one test... Unless there was a pulse thinner than the previous value and the solver happen to be lucky and find it previously, I don't understand why I had to reduce it that much. I hope that the idea in Keep the information of gate duration after the compilation #184, when implemented, will be able to bring some light on the issue.

Copy link
Contributor

@hodgestar hodgestar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, but I think @BoxiLi should approve the max_step change because he knows the most about how this works and I'd like to make sure he sees it.

@Ericgig Ericgig requested a review from BoxiLi January 19, 2023 21:13
@BoxiLi
Copy link
Member

BoxiLi commented Jan 20, 2023

Thanks! @Ericgig . Looks good

If I understand correctly qutip.Options are no longer needed. But just for compatibility, in the code, I should still use it, until qutip-qip drops the support of 4.7. Do we need to suppress the FutureWarning in the code for now?

It is good to know that SolverOption is no longer needed. This will remove quite some is_qutip5 branching in the code.

I somehow cannot reproduce the failing test when I set max_step=10. Which test was failing? This number is chosen empirically so it doesn't matter that much. For a large circuit, the true step size are usually much smaller than 1/10 or 1/25 of the circuit length. Just to be sure.

@Ericgig
Copy link
Member Author

Ericgig commented Jan 20, 2023

Yes Options is only there for compatibility and will raise a warning on use.

The test needing smaller max_step was test_device.test_numerical_evolution[DispersiveCavityQED, SNOT].

Copy link
Member

@BoxiLi BoxiLi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is likely just a coincidence. The pulse consists of 2 long pulses and 2 short pulses. They are quite unevenly distributed. I guess the new solver has a different way of estimating the step size.

It is not very bad to reduce it from 1/10 to 1/25 of the total circuit time, since it is only relevant when testing circuits with very few gates.

@BoxiLi BoxiLi merged commit 5710cfc into qutip:master Jan 21, 2023
@Ericgig Ericgig deleted the fix.bug.new.solver branch January 22, 2023 19:58
@BoxiLi BoxiLi added the qutip5 qutip 5 compatibility label Feb 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
qutip5 qutip 5 compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants